package com.i18n;

import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Currency;
import java.util.Locale;
//数字货币
public class NumberTest {
    public static void main(String[] args) throws ParseException {
        Locale us = Locale.CHINA;
        NumberFormat numberFormat = NumberFormat.getCurrencyInstance(us);
        //转为地区对应货币
        double num = 123456.78;
        System.out.println(numberFormat.format(num) );

        //根据地区数字解析为对应的Number，是一个Long，或者Double
        numberFormat.setCurrency(Currency.getInstance("CNY"));
        Number number = numberFormat.parse("￥123,456.78");
        System.out.println(number instanceof Double);




    }
}
